Carbon


SetControlAction

Header: Controls.h Carbon status: Supported

Sets or changes the action function for a control.

void SetControlAction (
    ControlRef theControl, 
    ControlActionUPP actionProc
);
theControl

A handle to the control whose action function is to be changed.

actionProc

A universal procedure pointer to an action function defining what action your application takes while the user holds down the mouse button. See ControlActionProcPtr for a description of an action function.

DISCUSSION

The SetControlAction function changes the contrlAction field of the control structure to point to the action function specified in the actionProc parameter. If the cursor is in the specified control, the functions HandleControlClick and TrackControl call this action function when the user holds down the mouse button. You must provide the action function, and it must define some action to perform repeatedly as long as the user holds down the mouse button. HandleControlUnderClick and TrackControl always highlight and drag the control as appropriate.

SetControlAction should be used to set the application-defined action function for providing live feedback for standard system scroll bar controls.

Note that the value in the contrlAction field of the control’s control structure is used by TrackControl only if you set the action function to TrackControl to Pointer(–1). Also, an action function is usually specified in a parameter to TrackControl; you generally don’t need to call SetControlAction to change it.

VERSION NOTES

This function was changed with Appearance Manager 1.0 to support live feedback.

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)